package jblip.base.resources;

import jblip.resources.Media;
import jblip.resources.Update;
import jblip.resources.User;
import jblip.resources.UserPicture;

class BaseUser implements User {
  private static final long serialVersionUID = 1L;

  private final Integer id_;

  private final String login_;

  private UserPicture avatar_;

  private String avatar_path_;

  private Media background_;

  private String background_path_;

  private Update status_;

  private String location_;

  private Sex sex_;

  BaseUser(final Integer id, final String login) {
    this.id_ = id;
    this.login_ = login;
    this.sex_ = Sex.UNKNOWN;
  }

  @Override
  public Update getCurrentStatus() {
    return status_;
  }

  @Override
  public Integer getID() {
    return id_;
  }

  @Override
  public String getLogin() {
    return login_;
  }

  @Override
  public UserPicture getAvatar() {
    return avatar_;
  }

  @Override
  public String getAvatarPath() {
    return avatar_path_;
  }

  @Override
  public Media getBackground() {
    return background_;
  }

  @Override
  public String getBackgroundPath() {
    return background_path_;
  }

  void setAvatar(final UserPicture avatar) {
    this.avatar_ = avatar;
  }

  void setBackgroundPicture(final Media background_picture) {
    this.background_ = background_picture;
  }

  void setAvatarPath(final String path) {
    this.avatar_path_ = path;
  }

  void setBackgroundPath(final String path) {
    this.background_path_ = path;
  }

  void setCurrentStatus(final Update current_status) {
    this.status_ = current_status;
  }

  @Override
  public String getLocation() {
    return this.location_;
  }

  void setLocation(final String location) {
    this.location_ = location;
  }

  @Override
  public Sex getSex() {
    return this.sex_;
  }

  void setSex(final String sex) {
    if (sex == null) {
      this.sex_ = Sex.UNKNOWN;
    } else if (sex.equals("m")) {
      this.sex_ = Sex.MALE;
    } else if (sex.equals("f")) {
      this.sex_ = Sex.FEMALE;
    } else {
      this.sex_ = Sex.UNKNOWN;
    }
  }
}
